/******************************************************
// Copyright 2008 Derrick Pallas. All rights reserved.
//
// This file is part of c-ptr.
//
// c-ptr is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// c-ptr is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with c-ptr.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef BASIC_PTR_H
#define BASIC_PTR_H

namespace ptr
{
  template< typename T, typename P = T* >
  class basic
  {
  public:
    typedef T my_type;
    typedef P ptr_type;

  protected:
    ptr_type ptr;
    basic( ptr_type that ) : ptr(that) { };
    
  public:
    operator bool() const { return bool(ptr); }
    operator my_type * () const { return &*ptr; }

    my_type & operator * ( ) const { return *ptr; }
    my_type * operator -> ( ) const { return ptr; }
  };
}

#endif // BASIC_PTR_H
